<!--
 * @Author: your name
 * @Date: 2021-07-13 21:51:16
 * @LastEditTime: 2021-07-16 16:04:53
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \练习库e:\72-briup\briupteamproj\src\views\components\Links.vue
-->
<template>
  <div class="links">
    <Link :link="link1" :name="name1"></Link>
    <Link :link="link2" :name="name2"></Link>
    <Link :link="link3" :name="name3"  :title="title"></Link>
  </div>
</template>

<script>
import Link from "./Links/Link.vue";
import {get} from '../../utils/request.js'
export default {
  components: {Link},
  data(){
    return {
      articleData:{},
      param:{
        page:1,
        pageSize:10,
        categoryId : 3
      },
       param1:{
        page:1,
        pageSize:10,
        categoryId : 4
      },
      param2:{
        page:1,
        pageSize:10,
        categoryId : 5
      },
      link1: [],
      link2: [],
      link3: [],
      name1: '',
      name2: '',
      name3: '',
      title: '',
      // links: []

}
  },
  methods:{
    // pageChangeHandler(page){
    //   // this.param.page = page;
    //   this.loadArticles();
    // },
    // loadArticles(){
    //   let url = "/index/article/pageQuery";
      
    //   get(url,this.param).then(resp => {
    //      console.log(resp.data.list);
    //      this.link1 = resp.data.list;
    //      this.link2 = resp.data.list[1];
    //      this.link3 = resp.data.list[2];
    //   })
    // },
    loadLinks() {
      let url = "/index/article/pageQuery";
        get(url, this.param).then((resp) => {
         this.link1 = resp.data.list;
          // console.log(this.link1);
        });
         get(url, this.param1).then((resp) => {
         this.link2 = resp.data.list;
          // console.log(this.link2);
        });
        get(url, this.param2).then((resp) => {
         this.link3 = resp.data.list;
          // console.log(this.link3);
        });
    },
    loadCategorys(){
      // let url = "/index/category/findAll";
      let url = "/index/findByKey";
      get(url,{name:"dlgl"}).then(resp => {
        this.name1 = resp.data.val;
        // console.log(this.name1)
      })
      get(url,{name:"dsjs"}).then(resp => {
        this.name2 = resp.data.val;
        // console.log(this.name2)
      })
      get(url,{name:"yqlj"}).then(resp => {
        this.name3 = resp.data.val;
        // console.log(this.name3)
      })
      get(url,{name:"more1"}).then(resp => {
        this.title = resp.data.val;
        // console.log(this.name3)
      })
      // get(url,{name:"right"}).then(resp =>{
      //   if(resp.data) {
      //     this.right = resp.data.val;
      //     console.log(this.right)
      //   }
      // })
    }
    },
    // loadright(){
    //   let url = "/index/findByKey";
    //   get(url,{name:"right"}).then(resp =>{
    //     if(resp.data) {
    //       this.right = resp.data.val;
    //       console.log(this.right)
    //     }
    //   })
    // }
  // },
  created(){
    // let categoryId = this.$route.query.categoryId;
    // this.param.categoryId = categoryId;
    // this.loadArticles();
    this.loadCategorys();
    this.loadLinks();
}
};
</script>
<style scoped>
.links {
  width: 20%;
  height: 95%;
  /* background-color: rgb(241,249,254); */
}


</style>